package com.xiangyi.teachingsystem.dao;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.xiangyi.teachingsystem.entity.po.Course;
import com.xiangyi.teachingsystem.entity.po.UserCourse;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
/*
用户和用户开设课程的中间表
 */
public interface UserCourseMapper extends BaseMapper<UserCourse> {

    @Select("SELECT c.id,c.course_name,c.course_url,c.course_desc,c.sign\n" +
            "FROM user_course u\n" +
            "LEFT JOIN course c\n" +
            "ON u.course_id=c.id\n" +
            "WHERE u.user_id=#{userId}")
    List<Course> teachingCourseList(Integer userId);
}
